home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qcombobox.h.z / qcombobox.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.7 KB  |  147 lines

  1. /**********************************************************************
  2. ** $Id: qcombobox.h,v 2.28 1998/07/03 00:09:48 hanord Exp $
  3. **
  4. ** Definition of QComboBox class
  5. **
  6. ** Created : 950426
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QCOMBOBOX_H
  25. #define QCOMBOBOX_H
  26.  
  27. #ifndef QT_H
  28. #include "qwidget.h"
  29. #endif // QT_H
  30.  
  31.  
  32. struct QComboData;
  33. class QStrList;
  34. class QLineEdit;
  35. class QValidator;
  36. class QListBox;
  37.  
  38.  
  39. class QComboBox : public QWidget
  40. {
  41.     Q_OBJECT
  42. public:
  43.     QComboBox( QWidget *parent=0, const char *name=0 );
  44.     QComboBox( bool rw, QWidget *parent=0, const char *name=0 );
  45.    ~QComboBox();
  46.  
  47.     int        count() const;
  48.  
  49.     void    insertStrList( const QStrList *, int index=-1 );
  50.     void    insertStrList( const char **, int numStrings=-1, int index=-1);
  51.  
  52.     void    insertItem( const char *text, int index=-1 );
  53.     void    insertItem( const QPixmap &pixmap, int index=-1 );
  54.  
  55.     void    removeItem( int index );
  56.     void    clear();
  57.  
  58.     const char *currentText() const;
  59.     const char *text( int index ) const;
  60.     const QPixmap *pixmap( int index ) const;
  61.  
  62.     void    changeItem( const char *text, int index );
  63.     void    changeItem( const QPixmap &pixmap, int index );
  64.  
  65.     int        currentItem() const;
  66.     void    setCurrentItem( int index );
  67.  
  68.     bool    autoResize()    const;
  69.     void    setAutoResize( bool );
  70.     QSize    sizeHint() const;
  71.  
  72.     void    setBackgroundColor( const QColor & );
  73.     void    setPalette( const QPalette & );
  74.     void    setFont( const QFont & );
  75.     void    setEnabled( bool );
  76.  
  77.     void    setSizeLimit( int );
  78.     int        sizeLimit() const;
  79.  
  80.     void    setMaxCount( int );
  81.     int        maxCount() const;
  82.  
  83.     enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom,
  84.           AfterCurrent, BeforeCurrent };
  85.  
  86.     void    setInsertionPolicy( Policy policy );
  87.     Policy     insertionPolicy() const;
  88.  
  89.     void    setStyle( GUIStyle );
  90.  
  91.     void    setValidator( QValidator * );
  92.     QValidator * validator() const;
  93.  
  94.     void    setListBox( QListBox * );
  95.     QListBox *     listBox() const;
  96.     
  97.     void    setAutoCompletion( bool );
  98.     bool    autoCompletion() const;
  99.  
  100.     bool    eventFilter( QObject *object, QEvent *event );
  101.  
  102. public slots:
  103.     void    clearValidator();
  104.     void    clearEdit();
  105.     void    setEditText( const char * );
  106.  
  107. signals:
  108.     void    activated( int index );
  109.     void    highlighted( int index );
  110.     void    activated( const char * );
  111.     void    highlighted( const char * );
  112.  
  113. private slots:
  114.     void    internalActivate( int );
  115.     void    internalHighlight( int );
  116.     void    internalClickTimeout();
  117.     void    returnPressed();
  118.  
  119. protected:
  120.     void    paintEvent( QPaintEvent * );
  121.     void    resizeEvent( QResizeEvent * );
  122.     void    mousePressEvent( QMouseEvent * );
  123.     void    mouseMoveEvent( QMouseEvent * );
  124.     void    mouseReleaseEvent( QMouseEvent * );
  125.     void    mouseDoubleClickEvent( QMouseEvent * );
  126.     void    keyPressEvent( QKeyEvent *e );
  127.     void    focusInEvent( QFocusEvent *e );
  128.  
  129.     void    popup();
  130.  
  131. private:
  132.     void    popDownListBox();
  133.     void    reIndex();
  134.     void    currentChanged();
  135.     QRect    arrowRect() const;
  136.     bool    getMetrics( int *dist, int *buttonW, int *buttonH ) const;
  137.  
  138.     QComboData    *d;
  139.  
  140. private:    // Disabled copy constructor and operator=
  141.     QComboBox( const QComboBox & );
  142.     QComboBox &operator=( const QComboBox & );
  143. };
  144.  
  145.  
  146. #endif // QCOMBOBOX_H
  147.